package com.zmytest.annotation.exceptionhandler;

import lombok.Data;

/**
 * Created on 2019/1/2.
 *
 * @author zhangmingyu
 */
@Data
public class ResponseDto<T> {

    private boolean success;

    private String message;

    private T data;


    public static<T> ResponseDto<T> success(T data){
        ResponseDto<T> responseDto = new ResponseDto<>();
        responseDto.setSuccess(true);
        responseDto.setData(data);
        return responseDto;
    }

    public static ResponseDto fail(String msg){
        ResponseDto responseDto = new ResponseDto();
        responseDto.setSuccess(false);
        responseDto.setMessage(msg);
        return responseDto;
    }
}
